package com.chinasofti.controltoken.controller;

import com.chinasofti.controlcommon.common.ServerResponse;
import com.chinasofti.controlcommon.domain.dto.LoginRequDTO;
import com.chinasofti.controltoken.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 登录请求
     *
     * @param loginRequDTO 用户名及密码等
     * @return ServerResponse 返回数据
     */
    @PostMapping("/login")
    //@RequestParam 是post请求字符串标注
    // @RequestBody 是标注对象参数，例：String addLable(@RequestBody PointMsg lableName)
    // PointMsg是实体类标注
    public ServerResponse login(@RequestBody LoginRequDTO loginRequDTO){
        return ServerResponse.createBySuccess(userService.login(loginRequDTO));
    }
    
    
}
